package com.example.mq.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.mq.po.MsgDelayPO;
import java.time.LocalDateTime;
import java.util.List;

public interface MsgDelayService extends IService<MsgDelayPO>
{
    /*
     * 批量插入消息
     * @param expectSendTime  期望发送时间
     * @param msgBodyJsonList
     * @return
     */
    List<MsgDelayPO> batchInsert(LocalDateTime expectSendTime, List<String> msgBodyJsonList);

    /*
     * 将消息状态置为成功
     * @param msgDelayPO
     */
    void updateStatusSuccess(MsgDelayPO msgDelayPO);

    /*
     * 将消息状态置为失败
     * @param msgDelayPO
     * @param failMsg       失败原因
     * @param sendRetry     是否还需要重试
     * @param nextRetryTime 下次重试发送时间
     */
    void updateStatusFail(MsgDelayPO msgDelayPO, String failMsg, boolean sendRetry, LocalDateTime nextRetryTime);

}
